<template>
  <div class="loginNav">
    <a
      href="javascript:;"
      class="navItem"
      v-for="(item,index) in navList"
      :key="index"
      :class="item.active?'active':''"
      @click="toggerNav(item,index)"
    >{{item.title}}</a>
  </div>
</template>

<script>
import Vue from 'vue'

export default Vue.extend({
  name: 'index',
  props: {
    navList: {
      type: Array
    }
  },
  data() {
    return {
      /* activeNum: 1,
      navList: [
        { title: '用户登录', link: '/mb/loginRegister/login', active: true },
        { title: '立即注册', link: '/mb/loginRegister/register', active: false }
      ] */
    }
  },
  methods: {
    toggerNav(item, index) {
      // console.log(index)
      if (this.$router.currentRoute.query.sid) {
        this.$router.push({ path: item.link, query: { sid: this.$router.currentRoute.query.sid } })
      } else {
        this.$router.push({ path: item.link })
      }
    }
  }
})
</script>

<style lang="scss">
@import 'src/styles/mixin.scss';
.loginNav {
  margin: 60px 20px 34px;
  padding: 20px 0;
  text-align: center;
  font-size: 0;
  .navItem {
    display: inline-block;
    margin: 0 40px;
    line-height: 60px;
    color: #666666;
    font-size: 30px;
    &.active {
      border-bottom: 3px solid #F30C23;
      color: #F30C23;
    }
  }
}
</style>
